<div class="region-goods-details row">
    <div class="region-goods-left col-sm-2">
        基本信息
    </div>
    <div class="region-goods-right col-sm-10">
        <div class="form-group">
            <label class="col-sm-2 control-label">排序</label>
            <div class="col-sm-9 col-xs-12">
                <input type="text" name="displayorder" id="displayorder" class="form-control" value="{$item['merchdisplayorder']}" />
                <span class='help-block'>数字越大，排名越靠前,如果为空，默认排序方式为创建时间</span>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-2 control-label must">商品名称</label>
            <div class="col-sm-7 goodsname"  style="padding-right:0;" >
                <input type="text" name="goodsname" id="goodsname" class="form-control" value="{$item['title']}" data-parent=".goodsname" data-rule-required="true" />
            </div>
            <div class="col-sm-2" style="padding-left:5px">
                <input type="text" name="unit" id="unit" class="form-control" value="{$item['unit']}" placeholder="单位, 如: 个/件/包" />
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-2 control-label">副标题</label>
            <div class="col-sm-9 subtitle">
                <input type="text" name="subtitle" id="subtitle" class="form-control" value="{$item['subtitle']}" data-parent=".subtitle" />
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-2 control-label">关键字</label>
            <div class="col-sm-9">
                <input type="text" name="keywords" class="form-control" value="{$item['keywords']}"/>
                <div class="help-block">商品关键字,能准确搜到商品的,比如 : 海尔电视|电视 之类的</div>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-2 control-label">商品类型</label>
            <div class="col-sm-9 col-xs-12">
                <input type="hidden" name="goodstype" value="{$item['type']}">
                <label class="radio-inline"><input type="radio" name="type" value="1" {if !empty($item['id'])} disabled {/if} {if empty($item['type']) || $item['type'] == 1}checked="true"{/if} onclick="$('#product').show();$('#type_virtual').hide()" /> 实体商品</label>
                <label class="radio-inline"><input type="radio" name="type" value="2" {if !empty($item['id'])} disabled {/if}  {if $item['type'] == 2}checked="true"{/if}  onclick="$('#product').hide();$('#type_virtual').hide()" /> 虚拟商品</label>
                <span class="help-block">商品类型，商品保存后无法修改，请谨慎选择</span>
            </div>
        </div>
    </div>
</div>
<div class="region-goods-details row">
    <div class="region-goods-left col-sm-2">
        商品信息
    </div>
    <div class="region-goods-right col-sm-10">
        <div class="form-group send-group" style="{if $item['type'] != 2}display: none;{/if}">
            <label class="col-sm-2 control-label">自动发货</label>
            <div class="col-sm-9 col-xs-12">
                <label class="radio-inline"><input type="radio" onclick="type_change(2);" name="virtualsend" value="0"  {if empty($item['virtualsend'])}checked="true"{/if}/> 否</label>
                <label class="radio-inline"><input type="radio" onclick="type_change(2);" name="virtualsend" value="1" {if $item['virtualsend'] == 1}checked="true"{/if}   /> 是</label>
                <span class="help-block">提示：发货后订单自动完成</span>
            </div>
        </div>
        <div class="form-group send-group" style="{if $item['type'] != 2}display: none;{/if}">
            <label class="col-sm-2 control-label">自动发货内容</label>
            <div class="col-sm-9 col-xs-12">
                <textarea class="form-control" name="virtualsendcontent">{$item['virtualsendcontent']}</textarea>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-2 control-label">商品分类【商城】</label>
            <div class="col-sm-8 col-xs-12">
                <select id="cates"  name='cates[]' class="form-control select2" style='width:605px;' multiple='' >
                    {foreach name='category' item='c'}
                    <option value="{$c['id']}" {if is_array($cates) &&  in_array($c['id'],$cates)}selected{/if} >{$c['name']}</option>
                    {/foreach}
                </select>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-2 control-label">商品属性</label>
            <div class="col-sm-9 col-xs-12" >
                <label for="isnew" class="checkbox-inline">
                    <input type="checkbox" name="isnew" value="1" id="isnew" {if $item['isnew'] == 1}checked="true"{/if} /> 新品
                </label>
                <label for="issendfree" class="checkbox-inline">
                    <input type="checkbox" name="issendfree" value="1" id="issendfree" {if $item['issendfree'] == 1}checked="true"{/if} /> 包邮
                </label>
                <label for="isnodiscount" class="checkbox-inline">
                    <input type="checkbox"  disabled   {if $item['isnodiscount'] == 1 || isset($item) }checked="true"{/if} /> 不参与商城会员折扣
                </label>                
                <span class="help-block">多商户商品默认不参与商城会员折扣</span>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-2 control-label">商品价格</label>
            <div class="col-sm-9 col-xs-12">
                <div class="input-group">
                    <input type="text" name="marketprice" id="marketprice" class="form-control" value="{$item['marketprice']}" />
                    <span class="input-group-addon">元 原价</span>
                    <input type="text" name="productprice" id="productprice" class="form-control" value="{$item['productprice']}" />
                    <span class="input-group-addon">元</span>
                </div>
                <span class='help-block'>尽量填写完整，有助于于商品销售的数据分析</span>
            </div>
        </div>
        <div class="form-group" {if empty($merch_user['goodscredit4'])}style="display: none;"{/if}>
            <label class="col-sm-2 control-label">支持用券</label>
            <div class="col-sm-9 col-xs-12">
                <label class="radio-inline"><input type="radio" name="iscredit4" value="0"  {if empty($item['iscredit4'])}checked="true"{/if}/> 否</label>
                <label class="radio-inline"><input type="radio" name="iscredit4" value="1" {if empty($item) || $item['iscredit4'] == 1}checked="true"{/if}   /> 是</label>
                <span class="help-block">提示：是否开启商品现金(余额)+券购买</span>
            </div>
        </div>
        {if $luckbuy == 1} 
        <div class="form-group">
            <label class="col-sm-2 control-label">幸运购折扣</label>
            <div class="col-sm-9 col-xs-12">
                <label class="radio-inline"><input type="radio" name="luckbuydiscount" value="7" {if $item['luckbuydiscount'] == 7}checked="true"{/if} /> 7折</label>
                <label class="radio-inline"><input type="radio" name="luckbuydiscount" value="6" {if $item['luckbuydiscount'] == 6}checked="true"{/if}/> 6折</label>
                <label class="radio-inline"><input type="radio" name="luckbuydiscount" value="5" {if $item['luckbuydiscount'] == 5}checked="true"{/if}/> 5折</label>
                <span class="help-block">70%商家结算（18%用于广告费+10%用于推广）；<br>
                        60%商家结算（27%用于广告费+10%用于推广）；<br>
                        50%商家结算（36%用于广告费+10%用于推广）。
                </span>
            </div>
        </div>
        {else}
        <div id="showcredit4s" style="{if !empty($item) && $item['iscredit4'] != 1}display: none;{/if}">
            <div class="form-group">
                <label class="col-sm-2 control-label">用券比例</label>
                <div class="col-sm-9 col-xs-12" >
                    <label for="credit4_rate_1" class="checkbox-inline" style="display: none;">
                        <input type="checkbox" name="credit4_rate_1" value="1" id="credit4_rate_1" {if $item['credit4_rate_1'] == 1}checked="true"{/if} /> 券比例0%
                    </label>
                    <label for="credit4_rate_2" class="checkbox-inline">
                        <input type="checkbox" name="credit4_rate_2" value="1" id="credit4_rate_2" {if $item['credit4_rate_2'] == 1}checked="true"{/if} /> 券比例100%
                    </label>
                    <label for="credit4_rate_3" class="checkbox-inline">
                        <input type="checkbox" name="credit4_rate_3" value="1" id="credit4_rate_3" {if $item['credit4_rate_3'] == 1}checked="true"{/if} /> 券比例90%
                    </label>
                    <label for="credit4_rate_4" class="checkbox-inline">
                        <input type="checkbox" name="credit4_rate_4" value="1" id="credit4_rate_4" {if $item['credit4_rate_4'] == 1}checked="true"{/if} /> 券比例80%
                    </label>
                    <label for="credit4_rate_5" class="checkbox-inline">
                        <input type="checkbox" name="credit4_rate_5" value="1" id="credit4_rate_5" {if $item['credit4_rate_5'] == 1}checked="true"{/if} /> 券比例70%
                    </label>
                    <label for="credit4_rate_6" class="checkbox-inline">
                        <input type="checkbox" name="credit4_rate_6" value="1" id="credit4_rate_6" {if $item['credit4_rate_6'] == 1}checked="true"{/if} /> 券比例60%
                    </label>
                    <span class="help-block">多商户商品必须选择一或多项用券购买</span>
                </div>
            </div>  
        </div>    
        {/if}    
        <div class="form-group">
            <label class="col-sm-2 control-label must">商品图片</label>
            <div class="col-sm-9 col-xs-12 gimgs">
                {:tpl_form_field_multi_image2('thumbs',$piclist)}
                <span class="help-block image-block">第一张为缩略图，建议为正方型图片，其他为详情页面图片，尺寸建议宽度为640，并保持图片大小一致</span>
                <span class="help-block">您可以拖动图片改变其显示顺序 </span>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-2 control-label"></label>
            <div class="col-sm-9 col-xs-12">
                <label class="checkbox-inline"><input type="checkbox" name="thumb_first" value="1" {if $item['thumb_first'] == 1}checked="true"{/if}   /> 详情显示首图</label>
                <span class="help-block"></span>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-2 control-label">已出售数</label>
            <div class="col-sm-6 col-xs-12">
                <div class="input-group">
                    <input type="text" name="sales" id="sales" class="form-control" value="{$item['sales']}" />
                    <span class="input-group-addon">件</span>
                </div>
            </div>
        </div>
    </div>
</div>
<div class="region-goods-details row">
    <div class="region-goods-left col-sm-2">
        商品属性
    </div>
    <div class="region-goods-right col-sm-10">
    <div class="form-group dispatch_info" {if ($item['type'] == 2 || $item['type'] == 3)}style="display: none;"{/if}>
    <label class="col-sm-2 control-label">运费设置</label>
    <div class="col-sm-6 col-xs-6" style='padding-left:0'>
        <div class="input-group">
            <span class='input-group-addon' style='border:none'><label class="radio-inline" style='margin-top:-7px;' ><input type="radio" name="dispatchtype" value="0" {if empty($item['dispatchtype'])}checked="true"{/if}   /> 运费模板</label></span>
            <select class="form-control tpl-category-parent select2" id="dispatchid" name="dispatchid">
                <option value="0">默认模板</option>
                {foreach name='dispatch_data' item='dispatch_item'}
                <option value="{$dispatch_item['id']}" {if $item['dispatchid'] == $dispatch_item['id']}selected="true"{/if}>{$dispatch_item['dispatchname']}</option>
                {/foreach}
            </select>
        </div>
    </div>
</div>

<div class="form-group dispatch_info" {if ($item['type'] == 2 || $item['type'] == 3)}style="display: none;"{/if}>
<label class="col-sm-2 control-label"></label>
<div class="col-sm-6 col-xs-6" style='padding-left:0'>
    <div class="input-group">
        <span class='input-group-addon' style='border:none'><label class="radio-inline"  style='margin-top:-7px;' ><input type="radio"name="dispatchtype" value="1" {if $item['dispatchtype'] == 1}checked="true"{/if}  /> 统一邮费</label></span>
        <input type="text" name="dispatchprice" id="dispatchprice" class="form-control" value="{$item['dispatchprice']}" />
        <span class="input-group-addon">元</span>
    </div>
</div>
</div>
    <div class="form-group">
        <label class="col-sm-2 control-label">所在地</label>
        <div class="col-sm-6 col-xs-6">
            <select id="sel-provance" name='province' onchange="selectCity();" class="form-control" style='width:200px;display: inline-block' >
                <option value="" selected="true">省/直辖市</option>
            </select>
            <select id="sel-city" name='city'  onchange="selectcounty(0)" class="form-control" style='width:200px;display: inline-block' >
                <option value="" selected="true">请选择</option>
            </select>
            <select id="sel-area" name='area'  class="form-control" style='width:200px;display: inline-block;display:none;' >
                <option value="" selected="true">请选择</option>
            </select>
    	<span class='help-block'>商品所在地，显示在详情页面，如果不选择，则显示商城所在地
    	    <script language='javascript'>
                cascdeInit1("{$new_area}","0","{$item['province']}","{$item['city']}","");
            </script>
        </div>
    </div>
    <div class="form-group">
        <label class="col-sm-2 control-label">其他</label>
        <div class="col-sm-9 col-xs-12">
            <label class="checkbox-inline" {if $item['isverify'] == 2 || $item['type'] == 2 || $item['type'] == 3}style="display:none;"{/if}><input type="checkbox" name="cash" value="2" {if $item['cash'] =='2'}checked="true"{/if}  /> 货到付款</label>
            <label class="checkbox-inline"><input type="checkbox" name="quality" value="1" {if !empty($item['quality'])}checked="true"{/if}   /> 正品保证</label>
            <label class="checkbox-inline"><input type="checkbox" name="seven" value="1" {if !empty($item['seven'])}checked="true"{/if}   /> 7天无理由退换</label>
            <label class="checkbox-inline"><input type="checkbox" name="invoice" value="1" {if !empty($item['invoice'])}checked="true"{/if}   /> 发票</label>
            <label class="checkbox-inline"><input type="checkbox" name="repair" value="1" {if !empty($item['repair'])}checked="true"{/if}   /> 保修</label>
        </div>
    </div>
    <div class="form-group">
        <label class="col-sm-2 control-label">上架</label>
        <div class="col-sm-9 col-xs-12">
            <label class="radio-inline"><input type="radio" name="status" value="1" {if $item['status'] == 1}checked="true"{/if}   /> 是</label>
            <label class="radio-inline"><input type="radio" name="status" value="0" {if empty($item['status'])}checked="true"{/if}/> 否</label>
            <span class="help-block"></span>
        </div>
    </div>
</div>


</div>
<script language="javascript">
    require(['jquery.ui'],function(){
        $('.multi-img-details').sortable();
    })
    $("input[name=iscredit4]").off('click').on('click',function () {
        if($(this).val()==1){
            $("#showcredit4s").show()
        }else{
            $("#showcredit4s").hide();
        }
    })
</script>